import React, { memo } from 'react';
import ReactAudioPlayer from 'react-audio-player';
import styles from './index.less';
import { IAudioConfig } from './schema';

const AudioPlayer = memo((props: IAudioConfig) => {
  const { height, path } = props;
  return (
    <div className={styles.audioWrap}>
      <ReactAudioPlayer
        src={path}
        autoPlay={false}
        controls
        style={{
          width: '100%',
          height: height + 'px',
        }}
      />
    </div>
  );
});

export default AudioPlayer;
